Good.php 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\model\GoodLog;
  4. use think\App;
  5. use think\db\Raw;
  6. use think\facade\Db;
  7. use think\facade\Validate;
  8. //线上商品
  9. class Good extends Base
  10. {
  11. private $acton=[];
  12. public $noble=[];
  13. public function __construct(App $app)
  14. {
  15. parent::__construct($app);
  16. $this->noble=\think\facade\Config::get("noble");
  17. $order=\think\facade\Config::get("order");
  18. $this->acton=$order['order_type'];
  19. }
  20. public function list(){
  21. $page = isset($this->post['page']) && $this->post['page'] !==""? intval($this->post['page']):"1";
  22. $size = isset($this->post['size']) && $this->post['size'] !==""? intval($this->post['size']):"10";
  23. $where =[["a.is_del","=",0]];
  24. $cat_id = isset($this->post['cat_id']) && $this->post['cat_id'] !=="" ? trim($this->post['cat_id']):"";
  25. if($cat_id!==""){
  26. $where[]=['a.cat_id',"=",$cat_id];
  27. }
  28. $good_name = isset($this->post['good_name']) && $this->post['good_name'] !=="" ? trim($this->post['good_name']):"";
  29. if($good_name!==""){
  30. $where[]=['a.good_name',"like","%$good_name%"];
  31. }
  32. $skucode = isset($this->post['skucode']) && $this->post['skucode'] !=="" ? trim($this->post['skucode']):"";
  33. if($skucode!==""){
  34. $where [] = ['b.skucode',"like","%$skucode%"];
  35. }
  36. $spucode = isset($this->post['spucode']) && $this->post['spucode'] !=="" ? trim($this->post['spucode']):"";
  37. if($spucode!==""){
  38. $where [] = ['b.spucode',"like","%$spucode%"];
  39. }
  40. $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
  41. if($start!==""){
  42. $where[]=['b.addtime',">=",date('Y-m-d H:i:s',strtotime($start))];
  43. }
  44. $end = isset($this->post['end']) && $this->post['end']!=="" ? $this->post['end']:"";
  45. if($end!==""){
  46. $where[]=['b.addtime',"<",date('Y-m-d H:i:s',strtotime($end)+24*3600)];
  47. }
  48. $is_stock = isset($this->post['is_stock']) && $this->post['is_stock'] !=="" ? intval($this->post['is_stock'])
  49. :"";
  50. if($is_stock!==""){
  51. $where[]=['a.is_stock',"=",$is_stock];
  52. }
  53. $good_type = isset($this->post['good_type']) && $this->post['good_type'] !=="" ? intval($this->post['good_type'])
  54. :"";
  55. if($good_type!==""){
  56. $where[]=['a.good_type',"=",$good_type];
  57. }
  58. $supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] !=="" ? trim($this->post['supplierNo'])
  59. :"";
  60. if($supplierNo!==""){
  61. $where[]=['a.supplierNo',"=",$supplierNo];
  62. }
  63. $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !=="" ? trim($this->post['companyNo']) :"";
  64. if($companyNo!==""){
  65. $where[]=['a.companyNo',"like","%$companyNo%"];
  66. }
  67. $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
  68. if($creater!==""){
  69. $where[]=['a.creater',"like","%$creater%"];
  70. }
  71. $createrid = isset($this->post['createrid']) && $this->post['createrid'] !=="" ? intval($this->post['createrid']):"";
  72. if($createrid!==""){
  73. $where[]=['a.createrid',"=",$createrid];
  74. }
  75. $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
  76. :"";
  77. if($status!==""){
  78. $where[]=['a.status',"=",$status];
  79. }
  80. $platform_code = isset($this->post['platform_code']) && $this->post['platform_code'] !=="" ? trim($this->post['platform_code'])
  81. :"";
  82. if($platform_code!==""){
  83. //$platform = Db::name("good_platform")->where(["platform_code"=>$platform_code,"is_del"=>0])->column
  84. //("spuCode");
  85. $where[]=["b.platform_code","=",$platform_code];
  86. }
  87. $plat_code = isset($this->post['plat_code']) && $this->post['plat_code'] !=="" ? trim($this->post['plat_code'])
  88. :"";
  89. if($plat_code!==""){
  90. $where[]=["b.plat_code","like","%$plat_code%"];
  91. }
  92. $exam_status = isset($this->post['exam_status']) && $this->post['exam_status'] !=="" ? intval($this->post['exam_status'])
  93. :"";
  94. if($exam_status!==""){
  95. $where[]=['b.exam_status',"=",$exam_status];
  96. }
  97. $brand_id = isset($this->post['brand_id']) && $this->post['brand_id'] !=="" ? intval($this->post['brand_id'])
  98. :"";
  99. if($brand_id!==""){
  100. $where[]=['a.brand_id',"=",$brand_id];
  101. }
  102. $role=$this->checkRole();
  103. if(!empty($role['write']) ){
  104. $where[]=["a.createrid","in",$role['write']];
  105. }
  106. $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
  107. if ($company_name !== "") $where[] = ["a.createrid", 'in', get_company_item_user_by_name($company_name)];
  108. // if(!empty($role['platform']) ){
  109. // $where[]=["b.platform_code","in",$role['platform']];
  110. // }
  111. $count = Db::name('good')
  112. ->alias("a")
  113. ->leftJoin("good_platform b","a.spuCode=b.spuCode")
  114. ->leftJoin("depart_user u", "u.uid=a.createrid AND u.is_del=0")
  115. ->leftJoin("platform p","p.id=b.platform_code")
  116. ->where('p.platform_type',0)//只筛选非对接平台的商品
  117. ->where($where)
  118. ->count();
  119. $total = ceil($count / $size);
  120. $page = $page >= $total ? $total : $page;
  121. $list = Db::name('good')
  122. ->alias("a")
  123. ->field("b.skuCode,b.platform_code,b.plat_code,b.id as good_id,a.cat_id,a.good_name,a.good_img,a.good_info_img,a.good_thumb_img,
  124. b.createrid,a.is_exclusive,a.brand_id,a.supplierNo,a.good_unit,a.noble_metal,a.companyNo,a.spuCode,a.good_type,b.creater,b.addtime,
  125. b.updatetime,b.exam_status,a.createrid purchase_id,a.creater purchase,u.itemid,a.is_stock")
  126. //成本表里的创建人,也是线上商品的采购人,为了防止混淆,给creater取个别名
  127. ->leftJoin("good_platform b","a.spuCode=b.spuCode")
  128. // ->leftJoin("good_basic gb","gb.spuCode=a.spuCode")
  129. ->leftJoin("depart_user u", "u.uid=a.createrid AND u.is_del=0")
  130. ->leftJoin("platform p","p.id=b.platform_code")
  131. ->where('p.platform_type',0)//只筛选非对接平台的商品
  132. ->where($where)
  133. ->page($page,$size)
  134. ->order("b.addtime desc")
  135. ->cursor();
  136. $data=[];
  137. foreach ($list as $value){
  138. $value['cat_info']= made($value['cat_id'],[]);
  139. $platform = Db::name("platform")->where(["id"=>$value['platform_code']])->find();
  140. $value['platform_name'] = isset($platform['platform_name']) ? $platform['platform_name']:"";
  141. $value['platform_code_en'] = isset($platform['platform_code_en']) ? $platform['platform_code_en']:"";
  142. $supplier = Db::name("supplier")->where(["code"=>$value['supplierNo']])->find();
  143. $value['supplier_name'] = isset($supplier['name']) ? $supplier['name']:"";
  144. $brand=Db::name("brand")->where(["id"=>$value['brand_id']])->find();
  145. $value["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
  146. $unit = Db::name("unit")->where(["id"=>$value['good_unit']])->find();
  147. $value['unit'] =isset($unit['unit'])?$unit['unit']:"";
  148. $company = Db::name("business")->where(["companyNo"=>$value['companyNo']])->find();
  149. $value['company'] = isset($company['company'])?$company['company']:"";
  150. $value['stock_total'] = Db::name("good_stock")->where(['spuCode'=>$value['spuCode'],"is_del"=>0])->sum("usable_stock");
  151. $value['status']=$value['exam_status'];
  152. $value['exclusive']=makeExcluse($value['is_exclusive']);
  153. // $value['good_info_img']=$value['good_info_img'];
  154. // $value['good_img']=$value['good_img'];
  155. $spec = Db::name("good_spec")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->select()->toArray();
  156. $speclist=[];
  157. if(!empty($spec)){
  158. foreach ($spec as $val){
  159. $temp=[];
  160. $temp['spec_id']=$val['spec_id'];
  161. $temp['spec_value_id']=$val['spec_value_id'];
  162. $sp = Db::name("specs")->where(["id"=>$val['spec_id']])->find();
  163. $temp['spec_name']=isset($sp["spec_name"]) ? $sp["spec_name"]:"";
  164. $spv = Db::name("spec_value")->where(["id"=>$val['spec_value_id']])->find();
  165. $temp['spec_value']=isset($spv["spec_value"]) ? $spv["spec_value"]:"";
  166. $speclist[]=$temp;
  167. }
  168. }
  169. $value['specinfo']=$speclist;
  170. $value['noble_name']=isset($value['noble_metal'])&&$value['noble_metal']!=0?$this->noble[$value['noble_metal']] :"";
  171. $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
  172. $data[]=$value;
  173. }
  174. return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
  175. }
  176. //获取跟有赞对接的平台所属的商品上线信息
  177. public function listByYz()
  178. {
  179. $param = $this->request->only([
  180. 'page' => 1,
  181. 'size' => 15,
  182. 'cat_id' => '',
  183. 'good_name' => '',
  184. 'skucode' => '',
  185. 'spucode' => '',
  186. 'start' => '',
  187. 'end' => '',
  188. 'is_stock' => '',
  189. 'good_type' => '',
  190. 'supplierNo' => '',
  191. 'companyNo' => '',
  192. 'creater' => '',
  193. 'createrid' => '',
  194. 'status' => '',
  195. 'platform_code' => '',
  196. 'plat_code' => '',
  197. 'exam_status' => '',
  198. 'brand_id' => '',
  199. 'company_name' => '',
  200. ], 'post', 'trim');
  201. $where = [["b.is_del", "=", 0]];
  202. if ($param['cat_id'] !== "") $where[] = ['a.cat_id', "=", $param['cat_id']];
  203. if ($param['good_name'] !== "") $where[] = ['a.good_name', 'like', '%' . $param['good_name'] . '%'];
  204. if ($param['skucode'] !== '') $where [] = ['b.skucode', 'like', '%' . $param['skucode'] . '%'];
  205. if ($param['spucode'] !== '') $where [] = ['b.spucode', 'like', '%' . $param['spucode'] . '%'];
  206. if ($param['start'] !== '') $where[] = ['b.addtime', '>=', date('Y-m-d H:i:s', strtotime($param['start']))];
  207. if ($param['end'] !== "") $where[] = ['b.addtime', "<", date('Y-m-d H:i:s', strtotime($param['end']) + 24 * 3600)];
  208. if ($param['is_stock'] !== "") $where[] = ['a.is_stock', "=", $param['is_stock']];
  209. if ($param['good_type'] !== "") $where[] = ['a.good_type', "=", $param['good_type']];
  210. if ($param['supplierNo'] !== "") $where[] = ['a.supplierNo', "=", $param['supplierNo']];
  211. if ($param['companyNo'] !== "") $where[] = ['a.companyNo', "like", '%' . $param['companyNo'] . '%'];
  212. if ($param['creater'] !== '') $where[] = ['a.creater', "like", '%' . $param['creater'] . '%'];
  213. if ($param['createrid'] !== '') $where[] = ['a.createrid', "=", $param['createrid']];
  214. if ($param['status'] !== '') $where[] = ['a.status', '=', $param['status']];
  215. if ($param['platform_code'] !== "") $where[] = ["b.platform_id", '=', $param['platform_code']];
  216. if ($param['plat_code'] !== '') $where[] = ["b.plat_code", "like", '%' . $param['plat_code'] . '%'];
  217. if ($param['exam_status'] !== '') $where[] = ['b.exam_status', "=", $param['exam_status']];
  218. if ($param['brand_id'] !== "") $where[] = ['a.brand_id', "=", $param['brand_id']];
  219. $role = $this->checkRole();
  220. if (!empty($role['write'])) $where[] = ["a.createrid", "in", $role['write']];
  221. if ($param['company_name'] !== '') $where[] = ["a.createrid", 'in', get_company_item_user_by_name($param['company_name'])];
  222. $count = Db::name('platform_youzan')
  223. ->alias("b")
  224. ->leftJoin("good_basic a", "a.spuCode=b.spuCode")
  225. ->leftJoin("depart_user u", "u.uid=a.createrid AND u.is_del=0")
  226. ->where($where)
  227. ->count();
  228. $total = ceil($count / $param['size']);
  229. $param['page'] = $param['page'] >= $total ? $total : $param['page'];
  230. $list = Db::name('platform_youzan')
  231. ->alias("b")
  232. ->field("b.skuCode,b.platform_id platform_code,b.plat_code,b.id as platform_youzan_id,a.cat_id,a.good_name,a.good_img,a.good_info_img,a.good_thumb_img,b.createrid,a.is_exclusive,a.brand_id,a.supplierNo,a.good_unit,a.noble_metal,a.companyNo,a.spuCode,a.good_type,b.creater,b.addtime,b.updatetime,b.exam_status,a.createrid purchase_id,a.creater purchase,u.itemid")//成本表里的创建人,也是线上商品的采购人,为了防止混淆,给creater取个别名
  233. ->leftJoin("good_basic a", "a.spuCode=b.spuCode")
  234. ->leftJoin("depart_user u", "u.uid=a.createrid AND u.is_del=0")
  235. ->where($where)
  236. ->page($param['page'], $param['size'])
  237. ->order("b.addtime desc")
  238. ->cursor();
  239. $data = [];
  240. foreach ($list as $value) {
  241. $value['cat_info'] = made($value['cat_id'], []);
  242. $platform = Db::name("platform")->field('id,platform_name')->where(["id" => $value['platform_code']])->find();
  243. $value['platform_name'] = isset($platform['platform_name']) ? $platform['platform_name'] : "";
  244. $value['platform_code_en'] = isset($platform['platform_code_en']) ? $platform['platform_code_en'] : "";
  245. $supplier = Db::name("supplier")->field('id,name')->where(["code" => $value['supplierNo']])->find();
  246. $value['supplier_name'] = isset($supplier['name']) ? $supplier['name'] : "";
  247. $brand = Db::name("brand")->field('id,brand_name')->where(["id" => $value['brand_id']])->find();
  248. $value["brand_name"] = isset($brand['brand_name']) ? $brand['brand_name'] : "";
  249. $unit = Db::name("unit")->field('id,unit')->where(["id" => $value['good_unit']])->find();
  250. $value['unit'] = isset($unit['unit']) ? $unit['unit'] : "";
  251. $company = Db::name("business")->field('id,company')->where(["companyNo" => $value['companyNo']])->find();
  252. $value['company'] = isset($company['company']) ? $company['company'] : "";
  253. $value['stock_total'] = Db::name("good_stock")->where(['spuCode' => $value['spuCode'], "is_del" => 0])->sum("usable_stock");
  254. $value['status'] = $value['exam_status'];
  255. $value['exclusive'] = makeExcluse($value['is_exclusive']);
  256. // $value['good_info_img']=$value['good_info_img'];
  257. // $value['good_img']=$value['good_img'];
  258. $spec = Db::name("good_spec")->where(["spuCode" => $value['spuCode'], "is_del" => 0])->select()->toArray();
  259. $speclist = [];
  260. if (!empty($spec)) {
  261. foreach ($spec as $val) {
  262. $temp = [];
  263. $temp['spec_id'] = $val['spec_id'];
  264. $temp['spec_value_id'] = $val['spec_value_id'];
  265. $sp = Db::name("specs")->where(["id" => $val['spec_id']])->find();
  266. $temp['spec_name'] = isset($sp["spec_name"]) ? $sp["spec_name"] : "";
  267. $spv = Db::name("spec_value")->where(["id" => $val['spec_value_id']])->find();
  268. $temp['spec_value'] = isset($spv["spec_value"]) ? $spv["spec_value"] : "";
  269. $speclist[] = $temp;
  270. }
  271. }
  272. $value['specinfo'] = $speclist;
  273. $value['noble_name'] = isset($value['noble_metal']) && $value['noble_metal'] != 0 ? $this->noble[$value['noble_metal']] : "";
  274. $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
  275. $data[] = $value;
  276. }
  277. return app_show(0, "获取成功", ['list' => $data, 'count' => $count]);
  278. }
  279. public function info(){
  280. $skucode=isset($this->post['skuCode'])&&$this->post['skuCode']!=""?trim($this->post['skuCode']):"";
  281. if($skucode==""){
  282. return error_show(1005,"参数skuCode不能为空");
  283. }
  284. $good_platform = Db::name("good_platform")->where(['skuCode'=>$skucode,"is_del"=>0])->find();
  285. if($good_platform==false){
  286. return error_show(1004,"未找到商品数据");
  287. }
  288. $data = Db::name("good")->where(["spuCode"=>$good_platform['spuCode'],"is_del"=>0])->find();
  289. if($data==false){
  290. return error_show(1004,"未找到商品数据");
  291. }
  292. $plat =Db::name("platform")->where(["id"=>$good_platform['platform_code']])->find();
  293. $data['skuCode']=$good_platform['skuCode'];
  294. $data['platform_code']=$good_platform['id'];
  295. $data['platform_code_en']=isset($plat['platform_code'])?$plat['platform_code']:"";
  296. $data['platform_name']=isset($plat['platform_name'])?$plat['platform_name']:"";
  297. $data['online_reason']=$good_platform['online_reason'];
  298. $data['online_time']=$good_platform['online_time'];
  299. $data['online_remark']=$good_platform['online_remark'];
  300. $data['exam_status']=$good_platform['exam_status'];
  301. $data['is_online']=$good_platform['is_online'];
  302. $data['plat_code']=$good_platform['plat_code'];
  303. $data['exclusive']=makeExcluse($data['is_exclusive']);
  304. $unit =Db::name("unit")->where(["id"=>$data['good_unit']])->find();
  305. $data['unit'] = isset($unit['unit'])?$unit['unit']:'';
  306. $data['cat_info'] = made($data['cat_id'],[]);
  307. $spec = Db::name("good_spec")->where(["spuCode"=>$good_platform['spuCode'],"is_del"=>0])->select()->toArray();
  308. $supplier = Db::name("supplier")->where(["code"=>$data['supplierNo']])->find();
  309. $data['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
  310. $data['noble_name']=isset($data['noble_metal'])&&$data['noble_metal']!=0?$this->noble[$data['noble_metal']] :"";
  311. $company = Db::name("business")->where(["companyNo"=>$data['companyNo']])->find();
  312. $data['company'] = isset($company['company'])?$company['company']:"";
  313. if($data['brand_id']!=0){
  314. $brand=Db::name("brand")->where(["id"=>$data['brand_id']])->find();
  315. $data["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
  316. }else{
  317. $data["brand_name"]="";
  318. $data["brand_id"]="";
  319. }
  320. $data['origin_place_cn']="";
  321. $data['delivery_place_cn']="";
  322. if($data['delivery_place']!==""){
  323. $place = ["provice_code"=>"","city_code"=>"","area_code"=>""];
  324. list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$data['delivery_place']);
  325. $data['delivery_place_cn']=GetAddr(json_encode($place));
  326. }
  327. if($data['origin_place']!==""){
  328. $place = ["provice_code"=>"","city_code"=>"","area_code"=>""];
  329. list($place['provice_code'],$place['city_code'],$place['area_code'])=explode(",",$data['origin_place']);
  330. $data['origin_place_cn']=GetAddr(json_encode($place));
  331. }
  332. $excluse = makeExcluse($data['is_exclusive']);
  333. $data['exclusive']=$excluse;
  334. $data["good_info_img"]=$data['good_info_img']!=""? $data['good_info_img']:[];
  335. $data["good_img"]=$data['good_img']!=""? $data['good_img']:[];
  336. $speclist=[];
  337. if(!empty($spec)){
  338. foreach ($spec as $value){
  339. $temp=[];
  340. $temp['id']=$value['id'];
  341. $temp['spuCode']=$value['spuCode'];
  342. $temp['spec_id']=$value['spec_id'];
  343. $temp['spec_value_id']=$value['spec_value_id'];
  344. $temp['is_del']=$value['is_del'];
  345. $sp = Db::name("specs")->where(["id"=>$value['spec_id']])->find();
  346. $temp['spec_name']=isset($sp["spec_name"]) ? $sp["spec_name"]:"";
  347. $spv = Db::name("spec_value")->where(["id"=>$value['spec_value_id']])->find();
  348. $temp['spec_value']=isset($spv["spec_value"]) ? $spv["spec_value"]:"";
  349. $speclist[]=$temp;
  350. }
  351. }
  352. $data["speclist"]=empty($speclist)?[]:$speclist;
  353. $ladder = Db::name("good_ladder")->where(['skuCode'=>$skucode,"is_del"=>0])->select()->toArray();
  354. $data["ladderlist"]=!empty($ladder)?$ladder:[];
  355. $nakelist = Db::name("good_nake")->where(['spuCode'=>$good_platform['spuCode'],"is_del"=>0])->select()->toArray();
  356. // $catinfo = Db::name("cat")->where(["id"=>$data['cat_id']])->find();
  357. $cat_top_list = $data['cat_info'];
  358. $cat_top_id = isset($cat_top_list[0]['id']) ? $cat_top_list[0]['id'] : 0;
  359. // $budget = isset($catinfo['order_rate']) ? $catinfo['order_rate']/100:0;
  360. $gold_price=0;
  361. if ($data['is_gold_price']==1 && $cat_top_id==6) {
  362. $gold_price = Db::name("gold_price1")->where(["type" => $data['noble_metal'], "status" => 1, "is_del" => 0])->order("addtime desc")->value('price', 0);
  363. }
  364. $data['gold_price'] =$gold_price;
  365. $nakearry=[];
  366. if(!empty($nakelist)){
  367. //实时金价
  368. foreach ($nakelist as $value){
  369. $value['sale_price'] =$value['nake_total'];
  370. //计算最终售价
  371. if ($data['is_gold_price']==1 && $cat_top_id==6) {
  372. //普通商品:直接用财务提交的售价字段;
  373. //贵金属( 商品重量* 最新金价 + 工艺费(财务定价提交的)* 商品重量+包装费+加标费+证书费+产品裸价+其他费用)=商品库商品直接下单的售价
  374. $value['sale_price'] = ($data['weight'] * $gold_price + $value['cost_fee'] * $data['weight'] + $value['package_fee'] + $value['mark_fee'] + $value['cert_fee'] + $value['nake_fee'] + $value['other_fee']);
  375. }
  376. $nakearry[] = $value;
  377. }
  378. }
  379. $proof =Db::name("good_proof")->where(["spuCode"=>$good_platform['spuCode'],"is_del"=>0])->order("updatetime desc")->field("id,proof_type,proof_url")->find();
  380. $data['proof'] = isset($proof)&&$proof!=false? $proof:[];
  381. $data["nakelist"]=$nakearry;
  382. //补充采购员字段
  383. //成本表里的创建人,也是线上商品的采购人,为了防止混淆,给creater取个别名
  384. $temp_basic_info = Db::name('good_basic')
  385. ->field('id,createrid purchase_id,creater purchase')
  386. ->where(['spuCode'=>$data['spuCode'],'is_del'=>0])
  387. ->find();
  388. $data['purchase_id'] = $temp_basic_info['purchase_id'];
  389. $data['purchase'] = $temp_basic_info['purchase'];
  390. return app_show(0,"获取成功",$data);
  391. }
  392. public function SetWarn(){
  393. $condition=["is_del"=>0];
  394. $wsm_code = isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']):"";
  395. if($wsm_code!=""){
  396. $condition["wsm_code"] = $wsm_code;
  397. }else{
  398. return error_show(1004,"参数wsm_code 不能为空");
  399. }
  400. $type_code = isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
  401. if($type_code!=""){
  402. $condition["good_type_code"] = $type_code;
  403. }else{
  404. return error_show(1004,"参数type_code 不能为空");
  405. }
  406. $good= Db::name("good_stock")->where($condition)->find();
  407. if(empty($good)){
  408. return error_show(1005,"未找到数据");
  409. }
  410. $warn_stock = isset($this->post['warn_stock']) &&$this->post['warn_stock'] !=="" ? intval($this->post['warn_stock']):"";
  411. if($warn_stock===""){
  412. return error_show(1005,"参数warn_stock 不能为空");
  413. }
  414. $good['warn_stock'] = $warn_stock;
  415. $good['updatetime'] = date("Y-m-d H:i:s");
  416. $up= Db::name("good_stock")->save($good);
  417. if($up){
  418. //商品变动日志表,good_log_code字段存储仓库编码
  419. $data = ['good_log_code' => $wsm_code, "stock_id" => $good['id'], "type" => 1, 'stock' => $warn_stock, "stock_name" => "warn_stock"];
  420. GoodLog::LogAdd($this->post['token'],$data,'setwarn');
  421. return app_show(0,"预警库存更新成功");
  422. }else{
  423. return error_show(1005,"预警库存更新失败");
  424. }
  425. }
  426. public function SetStatus(){
  427. $id = isset($this->post['id']) &&$this->post['id'] !=="" ? intval($this->post['id']):"";
  428. if($id===""){
  429. return error_show(1005,"参数id 不能为空");
  430. }
  431. $good= Db::name("good_type")->where(["id"=>$id,"is_del"=>0])->find();
  432. if(empty($good)){
  433. return error_show(1005,"未找到数据");
  434. }
  435. $good['status'] = $good['status']==1?0 :1;
  436. $good['updatetime'] = date("Y-m-d H:i:s");
  437. $msg = $good['status']==1?"下架" :"上架";
  438. $up= Db::name("good_type")->save($good);
  439. return $up ? app_show(0,"商品{$msg}成功"): error_show(1005,"商品{$msg}失败");
  440. }
  441. public function GetStock(){
  442. $condition = [["a.is_del","=",0]];
  443. $type_code = isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
  444. if($type_code!==""){
  445. $condition[]=["a.spuCode","=",$type_code];
  446. }
  447. $wsm_code = isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code'])
  448. :"";
  449. if($wsm_code!==""){
  450. //$condition["a.wsm_code"]=$wsm_code;
  451. $condition[]=["a.wsm_code","=",$type_code];
  452. }
  453. $suplierNo = isset($this->post['supplierNo']) &&$this->post['supplierNo'] !=="" ? trim($this->post['supplierNo'])
  454. :"";
  455. if($suplierNo!==""){
  456. $wsmcode = Db::name("warehouse_info")->where(['supplierNo'=>$suplierNo,"is_del"=>0])->column("wsm_code");
  457. $condition[]=["a.wsm_code","in",$wsmcode];
  458. }
  459. $list = Db::name("good_stock")->alias("a")->join("warehouse_info b","a.wsm_code=b.wsm_code","left")->join("supplier c","b.supplierNo=c.code","left")
  460. ->where($condition)->field("a.id,b.name as wsm_name,c.code,c.name,a.wait_in_stock,a.wait_out_stock,a.usable_stock,a.intra_stock,(a.wait_out_stock+a.usable_stock) as total_stock,a.status,a.warn_stock")->select();
  461. if(empty($list)){
  462. return error_show(1004,"未找到数据");
  463. }
  464. return app_show(0,"获取成功",$list);
  465. }
  466. /**
  467. * @return \think\response\Json|void
  468. * @throws \think\db\exception\DataNotFoundException
  469. * @throws \think\db\exception\DbException
  470. * @throws \think\db\exception\ModelNotFoundException
  471. */
  472. public function GetStockBet(){
  473. $page = isset($this->post['page']) &&$this->post['page'] !=="" ? intval($this->post['page']):1;
  474. $size = isset($this->post['size']) &&$this->post['size'] !=="" ? intval($this->post['size']):10;
  475. $condition = [["is_del","=",0]];
  476. $type_code = isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
  477. if($type_code!==""){
  478. $condition[]=["spuCode","like","%{$type_code}%"];
  479. }
  480. $wsm_code = isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code'])
  481. :"";
  482. if($wsm_code!==""){
  483. $condition[]=["wsm_code","=",$wsm_code];
  484. }
  485. $suplierNo = isset($this->post['suplierNo']) &&$this->post['suplierNo'] !=="" ? trim($this->post['suplierNo']):"";
  486. if($suplierNo!==""){
  487. $wsmcode = Db::name("warehouse_info")->where(['supplierNo'=>$suplierNo,"is_del"=>0])->column("wsm_code");
  488. $condition[]=["wsm_code","in",$wsmcode];
  489. }
  490. $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
  491. if ($companyNo !== "") {
  492. $wsmcode = Db::name("warehouse_info")->where(['companyNo'=>$companyNo,"is_del"=>0])->column("wsm_code");
  493. $condition[]=["wsm_code","in",$wsmcode];
  494. }
  495. $start = isset($this->post['start']) &&$this->post['start'] !=="" ? $this->post['start']:"";
  496. $end = isset($this->post['end']) &&$this->post['end'] !=="" ? $this->post['end']:"";
  497. if($start!=""){
  498. $condition[]=["addtime",">=",$start];
  499. }
  500. if($end!=""){
  501. $condition[]=["addtime","<=",$end];
  502. }
  503. $count = Db::name("good_stock")->where($condition)->count();
  504. $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
  505. $list = Db::name("good_stock")->where($condition)->page($page,$size)->order("addtime desc")->select();
  506. $data=[];
  507. foreach ($list as $key=>$value){
  508. $temp=[];
  509. if($value['wsm_code']!=""){
  510. $wsm = Db::name("warehouse_info")
  511. ->alias("a")
  512. ->leftJoin("supplier b","a.supplierNo=b.code")
  513. ->leftJoin("business bus","a.companyNo=bus.companyNo")
  514. ->where(['a.wsm_code'=>$value['wsm_code'],"a.is_del"=>0])
  515. ->field("a.name as wsm_name,wsm_code,a.supplierNo,b.name supplierName,a.companyNo,bus.company")
  516. ->find();
  517. }
  518. $temp['wsm_name'] = isset($wsm['wsm_name'])?$wsm['wsm_name']:"";
  519. $temp['wsm_code']=$value['wsm_code'];
  520. $temp['supplier_code']=isset($wsm['supplierNo'])?$wsm['supplierNo']:"";
  521. $temp['supplier_name']=isset($wsm['supplierName'])?$wsm['supplierName']:"";
  522. $temp['company_no']=isset($wsm['companyNo'])?$wsm['companyNo']:"";
  523. $temp['company_name']=isset($wsm['company'])?$wsm['company']:"";
  524. if($value['spuCode']!=""){
  525. $good=Db::name("good")
  526. ->alias('g')
  527. ->field('g.*,b.brand_name,u.unit')
  528. ->where(["g.spuCode"=>$value['spuCode'],"g.is_del"=>0])
  529. ->leftJoin('brand b','b.id=g.brand_id')
  530. ->leftJoin('unit u','u.id=g.good_unit')
  531. ->find();
  532. if (empty($good)) {
  533. $good = Db::name("good_zixun")
  534. ->alias('g')
  535. ->field('g.*,b.brand_name,u.unit')
  536. ->where(["g.spuCode" => $value['spuCode'], "g.is_del" => 0])
  537. ->leftJoin('brand b', 'b.id=g.brand_id')
  538. ->leftJoin('unit u', 'u.id=g.good_unit')
  539. ->find();
  540. }
  541. //规格信息
  542. $spec = Db::name("good_spec")->field('id,spec_id,spec_value_id')->where(["spuCode" => $value['spuCode'], "is_del" => 0])->select()->toArray();
  543. $speclist = [];
  544. if (!empty($spec)) {
  545. foreach ($spec as $val) {
  546. $tmp = [];
  547. $tmp['spec_id'] = $val['spec_id'];
  548. $tmp['spec_value_id'] = $val['spec_value_id'];
  549. $sp = Db::name("specs")->where(["id" => $val['spec_id']])->find();
  550. $tmp['spec_name'] = isset($sp["spec_name"]) ? $sp["spec_name"] : "";
  551. $spv = Db::name("spec_value")->where(["id" => $val['spec_value_id']])->find();
  552. $tmp['spec_value'] = isset($spv["spec_value"]) ? $spv["spec_value"] : "";
  553. $speclist[] = $tmp;
  554. }
  555. }
  556. $temp['specinfo'] = $speclist;
  557. }
  558. $temp['good_code']=isset($good['spuCode'])?$good['spuCode']:"";
  559. // $temp['type_code']=isset($good['type_code'])?$good['type_code']:"";
  560. $temp['good_name']=isset($good['good_name'])?$good['good_name']:"";
  561. $temp['unit']=isset($good['unit'])?$good['unit']:"";
  562. $temp['brand_name']=isset($good['brand_name'])?$good['brand_name']:"";
  563. // $temp['attribute']=isset($good['attribute'])?$good['attribute']:"";
  564. $temp['sort_f']=isset($good['cat_id'])?$good['cat_id']:"";
  565. $temp['cat_info']=isset($good['cat_id'])?made($good['cat_id']):"";
  566. $temp['usable_stock'] = $value['usable_stock'];
  567. $temp['wait_in_stock'] = $value['wait_in_stock'];
  568. $temp['wait_out_stock'] = $value['wait_out_stock'];
  569. $temp['intra_stock'] = $value['intra_stock'];
  570. $temp['total_stock'] = $value['wait_out_stock']+$value['usable_stock'];
  571. $temp['warn_stock'] = $value['warn_stock'];
  572. $temp['id'] = $value['id'];
  573. $temp['out_total'] =0;
  574. $temp['in_total'] = 0;
  575. $temp['addtime'] = $value['addtime'];
  576. $data[]=$temp;
  577. }
  578. return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
  579. }
  580. /**
  581. * @return \think\response\Json|void
  582. * @throws \think\db\exception\DataNotFoundException
  583. * @throws \think\db\exception\DbException
  584. * @throws \think\db\exception\ModelNotFoundException
  585. * @throws \think\exception\DbException
  586. */
  587. public function GetStockWsm(){
  588. $page = isset($this->post['page']) &&$this->post['page'] !=="" ? intval($this->post['page']):1;
  589. $size = isset($this->post['size']) &&$this->post['size'] !=="" ? intval($this->post['size']):10;
  590. $condition = [["gs.is_del","=",0]];
  591. $wsm_code = isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']):"";
  592. if($wsm_code!==""){
  593. $condition[]=["gs.wsm_code","=",$wsm_code];
  594. }
  595. $suplierNo = isset($this->post['supplierNo']) &&$this->post['supplierNo'] !=="" ? trim($this->post['supplierNo']):"";
  596. if($suplierNo!==""){
  597. $wsmcode = Db::name("warehouse_info")->where(['supplierNo'=>$suplierNo,"is_del"=>0])->column("wsm_code");
  598. $condition[]=["gs.wsm_code","in",$wsmcode];
  599. }
  600. $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
  601. if ($companyNo !== "") {
  602. $wsmcode = Db::name("warehouse_info")->where(['companyNo'=>$companyNo,"is_del"=>0])->column("wsm_code");
  603. $condition[]=["gs.wsm_code","in",$wsmcode];
  604. }
  605. $build= Db::name("good_stock")
  606. ->alias('gs')
  607. ->where($condition)
  608. ->where('whi.wsm_type','<>',2)//2表示虚拟仓,虚拟仓不参加统计
  609. ->leftJoin('warehouse_info whi','whi.wsm_code=gs.wsm_code AND whi.is_del=0')
  610. ->group("gs.wsm_code")
  611. ->field("gs.wsm_code")
  612. ->buildSql();
  613. $count = Db::table($build." a")->count();
  614. $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
  615. $list = Db::name("good_stock")
  616. ->alias('gs')
  617. ->where($condition)
  618. ->where('whi.wsm_type','<>',2)//2表示虚拟仓,虚拟仓不参加统计
  619. ->page($page,$size)
  620. ->leftJoin('warehouse_info whi','whi.wsm_code=gs.wsm_code AND whi.is_del=0')
  621. ->group("gs.wsm_code")
  622. ->field("gs.wsm_code,sum(wait_in_stock) wait_in_stock,sum(wait_out_stock) wait_out_stock,sum(usable_stock) usable_stock,sum(intra_stock) intra_stock,sum(warn_stock) warn_stock,sum(usable_stock+wait_out_stock) total_stock")
  623. ->select()
  624. ->toArray();
  625. $data=[];
  626. foreach ($list as $key=>$value){
  627. $temp=[];
  628. if($value['wsm_code']!=""){
  629. $wsm = Db::name("warehouse_info")
  630. ->alias("a")
  631. ->leftJoin("business bus", "bus.companyNo=a.companyNo")
  632. ->leftJoin("supplier b","a.supplierNo=b.code")
  633. ->where(['a.wsm_code'=>$value['wsm_code'],"a.is_del"=>0])
  634. ->field("a.name as wsm_name,wsm_code,a.supplierNo,b.name supplierName,a.companyNo,bus.company")
  635. ->find();
  636. $good = Db::name("good_stock")
  637. ->alias("a")
  638. ->leftJoin("good c","c.spuCode=a.spuCode")
  639. ->where(["a.wsm_code"=>$value['wsm_code'],"a.is_del"=>0,"c.is_del"=>0])
  640. ->select()
  641. ->toArray();
  642. //商品单位和品牌
  643. $good_unit_s = Db::name("unit")->whereIn('id', array_column($good, 'good_unit'))->where('is_del', 0)->column('unit', 'id');
  644. $brands = Db::name("brand")->whereIn('id', array_column($good, 'brand_id'))->where('is_del', 0)->column('brand_name', 'id');
  645. foreach ($good as &$item_good){
  646. //规格信息
  647. $spec = Db::name("good_spec")->field('id,spec_id,spec_value_id')->where(["spuCode" => $item_good['spuCode'], "is_del" => 0])->select()->toArray();
  648. $speclist = [];
  649. if (!empty($spec)) {
  650. foreach ($spec as $val) {
  651. $tmp = [];
  652. $tmp['spec_id'] = $val['spec_id'];
  653. $tmp['spec_value_id'] = $val['spec_value_id'];
  654. $sp = Db::name("specs")->where(["id" => $val['spec_id']])->find();
  655. $tmp['spec_name'] = isset($sp["spec_name"]) ? $sp["spec_name"] : "";
  656. $spv = Db::name("spec_value")->where(["id" => $val['spec_value_id']])->find();
  657. $tmp['spec_value'] = isset($spv["spec_value"]) ? $spv["spec_value"] : "";
  658. $speclist[] = $tmp;
  659. }
  660. }
  661. $item_good['specinfo'] = $speclist;
  662. $item_good['unit'] = $good_unit_s[$item_good['good_unit']]??'';
  663. $item_good['brand_name'] = $brands[$item_good['brand_id']]??'';
  664. $item_good['can'] = made($item_good['cat_id'],[]);
  665. $item_good['total_stock'] =$item_good['usable_stock']+$item_good['wait_out_stock'];
  666. }
  667. }
  668. $temp['wsm_name'] = isset($wsm['wsm_name'])?$wsm['wsm_name']:"";
  669. $temp['wsm_code']=$value['wsm_code'];
  670. $temp['supplier_code']=isset($wsm['supplierNo'])?$wsm['supplierNo']:"";
  671. $temp['supplier_name']=isset($wsm['supplierName'])?$wsm['supplierName']:"";
  672. $temp['company_no']=isset($wsm['companyNo'])?$wsm['companyNo']:"";
  673. $temp['company_name']=isset($wsm['company'])?$wsm['company']:"";
  674. $temp['usable_stock'] = $value['usable_stock'];
  675. $temp['wait_in_stock'] = $value['wait_in_stock'];
  676. $temp['wait_out_stock'] = $value['wait_out_stock'];
  677. $temp['intra_stock'] = $value['intra_stock'];
  678. $temp['total_stock'] = $value['usable_stock']+$value['wait_out_stock'] ;
  679. $temp['child']=isset($good)&&!empty($good) ? $good:[];
  680. $data[]=$temp;
  681. }
  682. return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
  683. }
  684. public function GetStockGod(){
  685. $page = isset($this->post['page']) &&$this->post['page'] !=="" ? intval($this->post['page']):1;
  686. $size = isset($this->post['size']) &&$this->post['size'] !=="" ? intval($this->post['size']):10;
  687. $condition = [["b.is_del","=",0],["c.usable_stock",">",0],["a.wsm_type","<>",2]];
  688. $type_code = isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
  689. if($type_code!==""){
  690. $condition[]=["b.spuCode","like","%{$type_code}%"];
  691. }
  692. $good_name = isset($this->post['good_name']) && $this->post['good_name'] !== "" ? trim($this->post['good_name']) : "";
  693. if ($good_name !== "") {
  694. $condition[] = ["b.good_name", "like", "%{$good_name}%"];
  695. }
  696. $count = Db::name("good")->alias("b")
  697. ->join("good_stock c","c.spuCode = b.spuCode","left")
  698. ->leftJoin("warehouse_info a","a.wsm_code=c.wsm_code")
  699. ->where($condition)
  700. ->group("b.spuCode,b.good_name,b.good_unit,b.cat_id,b.craft_desc,b.addtime")
  701. ->count();
  702. $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
  703. $list = Db::name("good")
  704. ->alias("b")
  705. ->join("good_stock c","c.spuCode = b.spuCode","left")
  706. ->leftJoin("warehouse_info a","a.wsm_code=c.wsm_code")
  707. ->where($condition)
  708. ->field("b.spuCode,b.good_name,b.good_unit,b.brand_id,b.cat_id,b.craft_desc,b.addtime,sum(c.wait_in_stock) wait_in_stock,sum(c.wait_out_stock) wait_out_stock,sum(c.usable_stock) usable_stock,sum(c.intra_stock) intra_stock,sum(c.warn_stock) warn_stock,(sum(c.usable_stock)+sum(c.wait_out_stock)) total_stock")
  709. ->page($page,$size)
  710. ->order("b.addtime desc")
  711. ->group("b.spuCode,b.good_name,b.good_unit,b.brand_id,b.cat_id,b.craft_desc,b.addtime")
  712. ->select()
  713. ->toArray();
  714. $data=[];
  715. if($list) {
  716. //商品单位和品牌
  717. $good_unit_s = Db::name("unit")->whereIn('id', array_column($list, 'good_unit'))->where('is_del', 0)->column('unit', 'id');
  718. $brands = Db::name("brand")->whereIn('id', array_column($list, 'brand_id'))->where('is_del', 0)->column('brand_name', 'id');
  719. foreach ($list as $key => $value) {
  720. $temp = [];
  721. if ($value['spuCode'] != "") {
  722. $child = Db::name("good_stock")
  723. ->alias("a")
  724. ->join("warehouse_info b", "a.wsm_code=b.wsm_code", "left")
  725. ->join("business bus", "bus.companyNo=b.companyNo", "left")
  726. ->join("supplier s", "s.code=b.supplierNo", "left")
  727. ->where(['a.spuCode' => $value['spuCode'], "a.is_del" => 0])
  728. ->where("b.wsm_type","<>",2)
  729. ->field("a.wsm_code,b.name wsm_name,a.wait_in_stock,a.wait_out_stock,a.usable_stock,a.intra_stock,(a.wait_out_stock+a.usable_stock) total_stock,a.warn_stock,b.supplierNo,s.name supplierName,b.companyNo,bus.company")
  730. ->select()
  731. ->toArray();
  732. // echo Db::name("good_stock")->getLastSql();
  733. }
  734. $temp['good_name'] = $value['good_name'];
  735. $temp['good_code'] = $value['spuCode'];
  736. $temp['type_code'] = '';
  737. // $unit = Db::name("unit")->where(['id' => $value['good_unit']])->find();
  738. $temp['unit'] =$good_unit_s[$value['good_unit']]??'';
  739. $temp['brand_name'] =$brands[$value['brand_id']]??'';
  740. $temp['sort_f'] = isset($value['cat_id']) ? made($value['cat_id']) : [];
  741. $temp['sort_f'] = implode('/', array_column($temp['sort_f'], 'name'));//由于这个字段原样在页面显示,所以在这里特意拼接成字符串
  742. $temp['attribute'] = $value['craft_desc'];
  743. $temp['addtime'] = $value['addtime'];
  744. $temp['usable_stock'] = isset($value['usable_stock']) ? $value['usable_stock'] : "";
  745. $temp['wait_in_stock'] = isset($value['wait_in_stock']) ? $value['wait_in_stock'] : "";
  746. $temp['wait_out_stock'] = isset($value['wait_out_stock']) ? $value['wait_out_stock'] : "";
  747. $temp['intra_stock'] = isset($value['intra_stock']) ? $value['intra_stock'] : "";
  748. $temp['total_stock'] = intval($value['wait_out_stock'])+intval($value['usable_stock']);
  749. // $temp['warn_stock'] = isset($value['warn_stock'])? $value['warn_stock']:"";
  750. $temp['child'] = isset($child) && !empty($child) ? $child : [];
  751. //规格信息
  752. $spec = Db::name("good_spec")->field('id,spec_id,spec_value_id')->where(["spuCode" => $value['spuCode'], "is_del" => 0])->select()->toArray();
  753. $speclist = [];
  754. if (!empty($spec)) {
  755. foreach ($spec as $val) {
  756. $tmp = [];
  757. $tmp['spec_id'] = $val['spec_id'];
  758. $tmp['spec_value_id'] = $val['spec_value_id'];
  759. $sp = Db::name("specs")->where(["id" => $val['spec_id']])->find();
  760. $tmp['spec_name'] = isset($sp["spec_name"]) ? $sp["spec_name"] : "";
  761. $spv = Db::name("spec_value")->where(["id" => $val['spec_value_id']])->find();
  762. $tmp['spec_value'] = isset($spv["spec_value"]) ? $spv["spec_value"] : "";
  763. $speclist[] = $tmp;
  764. }
  765. }
  766. $temp['specinfo'] = $speclist;
  767. $data[] = $temp;
  768. }
  769. }
  770. return app_show(0,"获取成功",["list"=>$data,"count"=>$count]);
  771. }
  772. /**
  773. * @return \think\response\Json|void
  774. * @throws \think\db\exception\DataNotFoundException
  775. * @throws \think\db\exception\DbException
  776. * @throws \think\db\exception\ModelNotFoundException
  777. */
  778. public function Stat(){
  779. $condition =[["gs.is_del","=",0]];
  780. $wsm_code = isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']):"";
  781. if($wsm_code!=""){
  782. //$condition["gs.wsm_code"] = $wsm_code;
  783. $condition[]=["gs.wsm_code","=",$wsm_code];
  784. }
  785. $suplierNo = isset($this->post['supplierNo']) &&$this->post['supplierNo'] !=="" ? trim($this->post['supplierNo']) :"";
  786. if($suplierNo!==""){
  787. $wsmcode = Db::name("warehouse_info")->where(['supplierNo'=>$suplierNo,"is_del"=>0])->column("wsm_code");
  788. $condition[]=["gs.wsm_code","in",$wsmcode];
  789. }
  790. $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
  791. if ($companyNo !== "") {
  792. // $where['khNo'] = $khNo;
  793. $wsmcode = Db::name("warehouse_info")->where(['companyNo'=>$companyNo,"is_del"=>0])->column("wsm_code");
  794. $condition[]=["gs.wsm_code","in",$wsmcode];
  795. }
  796. // $type_code = isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
  797. // if($type_code!=""){
  798. // $condition[] = ["gs.good_type_code","=",$type_code];
  799. // }
  800. $statlist = Db::name("good_stock")
  801. ->alias('gs')
  802. ->where($condition)
  803. ->where('whi.wsm_type','<>',2)//2表示虚拟仓,虚拟仓不参与
  804. ->leftJoin('warehouse_info whi','whi.wsm_code=gs.wsm_code AND whi.is_del=0')
  805. ->field("sum(gs.wait_in_stock) as wait_in_stock,sum(gs.wait_out_stock) as wait_out_stock ,sum(gs.usable_stock) as usable_stock,sum(gs.intra_stock) as intra_stock,sum(gs.usable_stock+gs.wait_out_stock) as total_stock,sum(gs.warn_stock) as warn_stock")
  806. ->find();
  807. return app_show(0,"获取成功",$statlist);
  808. }
  809. public function all(){
  810. $condtion=["a.is_del"=>0,"b.is_del"=>0];
  811. $wsmcode =isset($this->post['wsmcode']) &&$this->post['wsmcode'] !=="" ? trim($this->post['wsmcode']):"";
  812. if($wsmcode!=""){
  813. $typecode= Db::name("good_stock")->where(["wsm_code"=>$wsmcode,'is_del'=>0])->column("good_type_code");
  814. $condtion["b.type_code"] = $typecode;
  815. }
  816. $good_code =isset($this->post['type_code']) &&$this->post['type_code'] !=="" ? trim($this->post['type_code']):"";
  817. if($good_code!=""){
  818. $condtion['b.type_code'] = $good_code;
  819. }
  820. $goodcode =isset($this->post['good_code']) &&$this->post['good_code'] !=="" ? trim($this->post['good_code'])
  821. :"";
  822. if($goodcode!=""){
  823. $condtion['a.good_code'] = $goodcode;
  824. }
  825. $good_name =isset($this->post['good_name']) &&$this->post['good_name'] !=="" ? trim($this->post['good_name'])
  826. :"";
  827. if($good_name!=""){
  828. $condtion['a.good_name'] = Db::raw("like '%{$good_name}%'");
  829. }
  830. $supplierNo =isset($this->post['supplierNo']) &&$this->post['supplierNo'] !=="" ? trim($this->post['supplierNo']):"";
  831. if($supplierNo!=""){
  832. $supplier = Db::name("supplier")->where(["code"=>$supplierNo])->find();
  833. if(empty($supplier)){
  834. return error_show(1004,"未找到供应商信息");
  835. }
  836. $condtion["a.gys_code"] = $supplierNo;
  837. }
  838. $list = Db::name("good_type")->alias("b")->join("good a","a.good_code = b.good_code","left")
  839. ->where($condtion)->field("b.id,a.good_code,a.good_name,a.good_desc,a.brand,a.original_price,a.cg_saler,a.good_type,a.market_fee,a.gys_code,a.unit,
  840. a.sort_f,a.sort_s,a.sort_t,b.color,b.material,b.specs,b.is_main,b.type_code,b.attribute,b.status as bstatus,a.addtime,a.updatetime")
  841. ->select();
  842. $data=[];
  843. foreach ($list as $key=>$value){
  844. $stock = Db::name("good_stock")->where(["good_type_code"=>$value['type_code'],"is_del"=>0])->sum("usable_stock");
  845. $value['usable_stock']=$stock;
  846. $supplier = Db::name("supplier")->where(["code"=>$value['gys_code']])->find();
  847. $value['supplier_name'] =isset($supplier['name']) ?$supplier['name'] :"";
  848. $data[]=$value;
  849. }
  850. return app_show(0,"获取成功",$data);
  851. }
  852. //库存概况
  853. public function loglist(){
  854. $param = $this->request->filter('trim')->only(['wsm_code'=>'','supplierNo'=>'','companyNo'=>'','is_stock'=>'','good_name'=>'','spuCode'=>'','page'=>1,'size'=>10],'post');
  855. // $page = isset($this->post['page']) && $this->post['page']!==""? intval($this->post['page']) :"1";
  856. // $size = isset($this->post['size']) && $this->post['size']!==""? intval($this->post['size']) :"10";
  857. $where=[];
  858. // $wsm_code= isset($this->post['wsm_code']) && $this->post['wsm_code']!="" ? trim($this->post['wsm_code']):"";
  859. if($param['wsm_code']!="") $where[]=['b.wsm_code',"like","%".$param['wsm_code']."%"];
  860. // $supplierNo =isset($this->post['supplierNo']) &&$this->post['supplierNo'] !=="" ? trim($this->post['supplierNo']):"";
  861. if($param['supplierNo']!=""){
  862. $supplier = Db::name("supplier")->where(["code"=>$param['supplierNo']])->find();
  863. if(empty($supplier)) return error_show(1004,"未找到供应商信息");
  864. $wsmcode = Db::name("warehouse_info")->where(["is_del"=>0,"supplierNo"=>$param['supplierNo']])->column("wsm_code");
  865. $where[]=['b.wsm_code',"in",$wsmcode];
  866. }
  867. // $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
  868. if ($param['companyNo'] !== "") {
  869. $wsmcode = Db::name("warehouse_info")->where(['companyNo'=>$param['companyNo'],"is_del"=>0])->column("wsm_code");
  870. $where[]=["b.wsm_code","in",$wsmcode];
  871. }
  872. if($param['is_stock']!="") $where[]=['c.is_stock','=',$param['is_stock']];
  873. if($param['good_name']!="") $where[]=['c.good_name','like','%'.$param['good_name'].'%'];
  874. if($param['spuCode']!="") $where[]=['b.spuCode','like','%'.$param['spuCode'].'%'];
  875. $count = Db::name("good_log")
  876. ->alias('a')
  877. ->join("good_stock b","b.id=a.id","left")
  878. ->where($where)
  879. ->count();
  880. $total = ceil($count/$param['size']);
  881. $page = $total>=$param['page'] ? $param['page'] :$total;
  882. $list = Db::name("good_log")
  883. ->alias('a')
  884. ->field("a.good_log_code,a.action_name,a.type,a.stock_name,a.stock,a.action_type,b.spuCode,a.addtime,a.action_uid,b.wsm_code,c.is_stock,c.good_name,c.cat_id")
  885. ->leftJoin('good_stock b','b.id=a.stock_id')
  886. ->leftJoin('good c','c.spuCode=b.spuCode')
  887. ->where($where)
  888. ->page($page,$param['size'])
  889. ->order("a.addtime desc")
  890. ->select()
  891. ->toArray();
  892. $data=[];
  893. $action_uids = array_column($list, 'action_uid');
  894. $action_uids = array_unique($action_uids);
  895. $item = [];
  896. foreach ($action_uids as $action_uid) {
  897. $items = Db::name("depart_user")->where('uid', $action_uid)->column("itemid");
  898. foreach ($items as $it) {
  899. $item[$action_uid][] = implode('/', array_column(GetPart($it), 'name'));
  900. }
  901. }
  902. foreach ($list as &$value){
  903. $wsm = Db::name("warehouse_info")
  904. ->alias("a")
  905. ->Join("supplier b","a.supplierNo=b.code","left")
  906. ->Join("business bus","bus.companyNo=a.companyNo","left")
  907. ->where(['a.wsm_code'=>$value['wsm_code'],"a.is_del"=>0])
  908. ->field("a.name as wsm_name,wsm_code,b.code,b.name,bus.company,bus.companyNo")
  909. ->find();
  910. // $godd = Db::name("good")->field('id,good_name,cat_id,is_stock')->where(["spuCode" => $value['spuCode'], "is_del" => 0])->find();
  911. // $value['good_name']=isset($godd['good_name'])? $godd['good_name']:"";
  912. // $value['cat_id']=isset($godd['cat_id'])? $godd['cat_id']:"";
  913. // $value['is_stock']=isset($godd['is_stock'])? $godd['is_stock']:"";
  914. $int = isset($value['cat_id']) && $value['cat_id'] != 0 ? made($value['cat_id']) : [];
  915. $value['wsm_name'] =$wsm['wsm_name'];
  916. $value['wsm_code'] =$wsm['wsm_code'];
  917. $value['code'] =$wsm['code'];
  918. $value['name'] =$wsm['name'];
  919. $value['action_type_cn'] =$this->acton[$value['action_type']];
  920. $value['item'] = isset($item[$value['action_uid']]) ? $item[$value['action_uid']] : '';
  921. $value['can'] =$int;
  922. $value['company'] =$wsm['company']??'';
  923. $value['companyNo'] =$wsm['companyNo']??'';
  924. // $data[]=$value;
  925. }
  926. return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
  927. }
  928. public function goodlist()
  929. {
  930. $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
  931. $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
  932. $where = [["a.is_del", "=", 0], ["b.exam_status", "=", 6], ["b.is_del", "=", 0], ["c.is_del", "=", 0], ["c.status", "=", 1]];
  933. $paltcode = isset($this->post["platform_code"]) && $this->post["platform_code"] != "" ? trim($this->post["platform_code"]) : "";
  934. if ($paltcode != "") {
  935. $where[] = ["platform_code", "=", $paltcode];
  936. }
  937. $companyNo = isset($this->post["companyNo"]) && $this->post["companyNo"] != "" ? trim($this->post["companyNo"]) : "";
  938. if ($companyNo != "") {
  939. $where[] = ["companyNo", "like", "%$companyNo%"];
  940. }
  941. $cat_id = isset($this->post["cat_id"]) && $this->post["cat_id"] !== "" ? intval($this->post["cat_id"]) : "";
  942. if ($cat_id !== "") {
  943. //获取当前分类及所有子级
  944. $where[] = ["cat_id", "in", manger([$cat_id])];
  945. }
  946. $buy_num = isset($this->post["buy_num"]) && $this->post["buy_num"] !== "" ? intval($this->post["buy_num"]) : "";
  947. if ($buy_num !== "") {
  948. $where[] = ["c.min_num", "<=", $buy_num];
  949. }
  950. $price = isset($this->post["price"]) && $this->post["price"] !== "" ? floatval($this->post["price"]) : "";
  951. if ($price !== "") {
  952. $where[] = ["c.sale_price", "<=", $price];
  953. }
  954. $temp = Db::name('good_ladder')
  955. ->field('skuCode,MAX(min_num) min_num')
  956. ->where([
  957. ['min_num', '<=', $buy_num],
  958. ['sale_price', '<=', $price],
  959. ['is_del', '=', 0],
  960. ['status', '=', 1],
  961. ])->group('skuCode')
  962. ->order('skuCode', 'desc')->buildSql();
  963. $count = Db::name('good_ladder')
  964. ->alias('c')
  965. ->field('c.id,c.skuCode,c.min_num,c.sale_price,a.good_name,a.`spuCode`,a.`cat_id`,a.`brand_id`,a.`companyNo`,a.`supplierNo`,a.`good_unit`,b.`skuCode`,b.`platform_code`,b.`plat_code`,b.id AS good_id,b.`addtime`,b.`updatetime`,b.`exam_status`')
  966. ->join($temp . ' temp', 'temp.skuCode = c.skuCode AND temp.min_num = c.min_num')
  967. ->leftJoin('good_platform b', 'b.skuCode=c.skuCode')
  968. ->leftJoin('good a', 'a.spuCode = b.spuCode AND a.is_del=0')
  969. ->where($where)
  970. ->count();
  971. $total = ceil($count / $size);
  972. $page = $page >= $total ? $total : $page;
  973. $list = Db::name('good_ladder')
  974. ->alias('c')
  975. ->field('c.id,c.skuCode,c.min_num,c.sale_price,a.good_name,a.`spuCode`,a.`cat_id`,a.`brand_id`,a.`companyNo`,a.`supplierNo`,a.`good_unit`,b.`skuCode`,b.`platform_code`,b.`plat_code`,b.id AS good_id,b.`addtime`,b.`updatetime`,b.`exam_status`')
  976. ->join($temp . ' temp', 'temp.skuCode = c.skuCode AND temp.min_num = c.min_num')
  977. ->leftJoin('good_platform b', 'b.skuCode=c.skuCode')
  978. ->leftJoin('good a', 'a.spuCode = b.spuCode AND a.is_del=0')
  979. ->where($where)
  980. ->page($page,$size)
  981. ->select()
  982. ->toArray();
  983. // $list = Db::name('good')
  984. // ->alias("a")
  985. // ->leftJoin("good_platform b","a.spuCode=b.spuCode")
  986. // ->leftJoin("good_ladder c","b.skuCode=c.skuCode")
  987. // ->where($where)->fetchSql()
  988. // ->where('a.spuCode','SKU2205251851017540')
  989. // ->page($page,$size)
  990. // ->field("c.id,c.min_num,c.sale_price,a.good_name,a.spuCode,a.cat_id,a.brand_id,a.companyNo,a.supplierNo,a.good_unit,b.skuCode,b.platform_code,b.plat_code,b.id as good_id,b.addtime,b.updatetime,b.exam_status")
  991. // ->order("b.addtime desc")
  992. // ->select();halt($list);
  993. // ->toArray();
  994. $data = [];
  995. foreach ($list as $value) {
  996. $value['cat_info'] = made($value['cat_id'], []);
  997. $platform = Db::name("platform")->where(["id" => $value['platform_code']])->find();
  998. $value['platform_name'] = isset($platform['platform_name']) ? $platform['platform_name'] : "";
  999. $value['platform_code_en'] = isset($platform['platform_code']) ? $platform['platform_code'] : "";
  1000. $supplier = Db::name("supplier")->where(["code" => $value['supplierNo']])->find();
  1001. $value['supplier_name'] = isset($supplier['name']) ? $supplier['name'] : "";
  1002. $brand = Db::name("brand")->where(["id" => $value['brand_id']])->find();
  1003. $value["brand_name"] = isset($brand['brand_name']) ? $brand['brand_name'] : "";
  1004. $unit = Db::name("unit")->where(["id" => $value['good_unit']])->find();
  1005. $value['unit'] = isset($unit['unit']) ? $unit['unit'] : "";
  1006. $company = Db::name("business")->where(["companyNo" => $value['companyNo']])->find();
  1007. $value['company'] = isset($company['company']) ? $company['company'] : "";
  1008. $value['stock_total'] = Db::name("good_stock")->where(['spuCode' => $value['spuCode'], "is_del" => 0])->sum("usable_stock");
  1009. $value['status'] = $value['exam_status'];
  1010. $data[] = $value;
  1011. }
  1012. return app_show(0, "获取成功", ['list' => $data, 'count' => $count]);
  1013. }
  1014. //根据价格区间,筛选符合条件的商品列表
  1015. public function getGoodListByLadder()
  1016. {
  1017. //1.请求参数
  1018. $param = $this->request->only([
  1019. 'good_type' => '',
  1020. // 'start' => '',
  1021. // 'end' => '',
  1022. 'is_stock' => '',
  1023. 'cat_id' => 0,
  1024. 'brand_id' => 0,
  1025. 'min_price' => 0,
  1026. 'max_price' => 0,
  1027. 'moq' => 0,//最低起订量?
  1028. 'good_name' => '',
  1029. 'skucode' => '',
  1030. 'spucode' => '',
  1031. 'companyNo' => '',//业务企业编号
  1032. 'plat_code' => '',//平台商品编号
  1033. 'creater' => '',//创建人
  1034. 'platform_code' => '',
  1035. 'supplierNo' => '',
  1036. 'page' => 1,
  1037. 'size' => 15,
  1038. 'company_name'=>'',
  1039. ], 'post', 'trim');
  1040. $where = [["gl.is_del", "=", 0], ['gp.exam_status', '=', 6]];//exam_status==6已上线
  1041. if ($param['good_type']!='') $where[] = ['gb.good_type', '=', $param['good_type']];
  1042. // if (!empty($param['start'])) $where[] = ['gl.addtime', '>=', $param['start']];
  1043. // if (!empty($param['end'])) $where[] = ['gl.addtime', '<=', $param['end'] . ' 23:59:59'];
  1044. if ($param['is_stock']!='') $where[] = ['gb.is_stock', '=', $param['is_stock']];
  1045. if (!empty($param['cat_id'])) $where[] = ['gb.cat_id', '=', $param['cat_id']];
  1046. if (!empty($param['brand_id'])) $where[] = ['gb.brand_id', '=', $param['brand_id']];
  1047. if ($param['min_price']!='' && $param['max_price']!='') $where[] = ['gl.sale_price', 'between', [$param['min_price'], $param['max_price']]];
  1048. if (!empty($param['moq'])) $where[] = ['gl.min_num', '>=', $param['moq']];
  1049. if (!empty($param['good_name'])) $where[] = ['gb.good_name', 'like', '%' . $param['good_name'] . '%'];
  1050. if (!empty($param['skucode'])) $where[] = ['gl.skuCode', 'like', '%' . $param['skucode'] . '%'];
  1051. if (!empty($param['spucode'])) $where[] = ['gp.spuCode', 'like', '%' . $param['spucode'] . '%'];
  1052. if (!empty($param['companyNo'])) $where[] = ['gb.companyNo', 'like', '%' . $param['companyNo'], '%'];
  1053. if (!empty($param['plat_code'])) $where[] = ['gp.plat_code', 'like', '%' . $param['plat_code'], '%'];
  1054. if (!empty($param['creater'])) $where[] = ['gb.creater', 'like', '%' . $param['creater'], '%'];
  1055. if (!empty($param['platform_code'])) $where[] = ['gp.platform_code', 'like', '%' . $param['platform_code'], '%'];
  1056. if (!empty($param['company_name'])) $where[] = ['gb.createrid', 'in', get_company_item_user_by_name($param['company_name'])];
  1057. // if (!empty($param['supplierNo'])) $where[] = ['supplierNo', 'like', '%'.$param['supplierNo'],'%'];
  1058. //5.获取结果
  1059. $count = Db::name('good_ladder')
  1060. ->alias('gl')
  1061. //->field('gl.id,gl.skuCode,gp.spuCode,p.platform_name,gb.good_thumb_img,gb.good_name,gb.cat_id,gb.good_type,gb.is_stock,gb.brand_id,gp.plat_code,gl.min_num,gl.sale_price,gb.creater purchase,gb.creater,gb.companyNo,u.itemid')
  1062. ->leftJoin('good_platform gp', 'gp.skuCode=gl.skuCode AND gp.is_del=0')
  1063. ->leftJoin('platform p', 'p.id=gp.platform_code AND p.is_del=0')
  1064. ->leftJoin('good gb', 'gb.spuCode=gp.spuCode AND gb.is_del=0')
  1065. ->leftJoin("depart_user u", "u.uid=gb.createrid AND u.is_del=0")
  1066. ->where($where)
  1067. ->count('gl.id');
  1068. $list = Db::name('good_ladder')
  1069. ->alias('gl')
  1070. ->field('gl.id,gl.skuCode,gp.spuCode,p.platform_name,gb.good_thumb_img,gb.good_name,gb.cat_id,gb.good_type,gb.is_stock,gb.brand_id,gp.plat_code,gl.min_num moq,gl.sale_price,gb.creater purchase,gb.creater,gb.companyNo,u.itemid')
  1071. ->leftJoin('good_platform gp', 'gp.skuCode=gl.skuCode AND gp.is_del=0')
  1072. ->leftJoin('platform p', 'p.id=gp.platform_code AND p.is_del=0')
  1073. ->leftJoin('good_basic gb', 'gb.spuCode=gp.spuCode AND gb.is_del=0')
  1074. ->leftJoin("depart_user u", "u.uid=gb.createrid AND u.is_del=0")
  1075. ->where($where)
  1076. ->page($param['page'], $param['size'])
  1077. ->order(['gl.skuCode' => 'asc', 'gl.addtime' => 'desc', 'gl.id' => 'desc'])
  1078. ->select()
  1079. ->toArray();
  1080. //6.补充数据,照搬list方法
  1081. $all_brand = Db::name('brand')
  1082. ->where('is_del', 0)
  1083. ->whereIn('id', array_column($list, 'brand_id'))
  1084. ->column('brand_name', 'id');
  1085. $all_company = Db::name('business')
  1086. ->where('is_del', 0)
  1087. ->whereIn('companyNo', array_column($list, 'companyNo'))
  1088. ->column('company', 'companyNo');
  1089. foreach ($list as &$value) {
  1090. $value['cat_info'] = made($value['cat_id'], []);
  1091. $value['brand_name'] = isset($all_brand[$value['brand_id']]) ? $all_brand[$value['brand_id']] : '';
  1092. $value['company'] = isset($all_company[$value['companyNo']]) ? $all_company[$value['companyNo']] : '';
  1093. $value['stock_total'] = Db::name("good_stock")
  1094. ->where(['spuCode' => $value['spuCode'], "is_del" => 0])
  1095. ->sum("usable_stock");
  1096. $value['company_name'] = implode('/', array_column(GetPart($value['itemid']), 'name'));
  1097. }
  1098. return app_show(0, "获取成功", ['list' => $list, 'count' => $count]);
  1099. }
  1100. }