|
@@ -52,8 +52,8 @@ public function goodlist(){
|
|
|
return app_show(0,"获取成功",['count'=>$count,'list'=>$list]);
|
|
|
}
|
|
|
public function create(){
|
|
|
- $wsm_code = isset($this->post['wsm_code ']) && $this->post['wsm_code '] !=="" ? trim($this->post['wsm_code ']):"";
|
|
|
- if($wsm_code!==""){
|
|
|
+ $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']):"";
|
|
|
+ if($wsm_code==""){
|
|
|
return error_show(1002,"盘点仓库编号不能为空");
|
|
|
}
|
|
|
$type = isset($this->post['type']) && $this->post['type'] !=="" ? trim($this->post['type']) :"";
|
|
@@ -61,11 +61,20 @@ public function create(){
|
|
|
return error_show(1002,"盘点类型不能为空");
|
|
|
}
|
|
|
$check_code = isset($this->post['check_code']) && $this->post['check_code'] !=="" ? trim($this->post['check_code']) : "";
|
|
|
+ if($check_code==""){
|
|
|
+ return error_show(1002,"盘点编号不能为空");
|
|
|
+ }
|
|
|
$apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !=="" ? trim($this->post['apply_id']):"";
|
|
|
$apply_name = isset($this->post['apply_name']) && $this->post['apply_name'] !=="" ? trim($this->post['apply_name']):"";
|
|
|
$status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']) :"0";
|
|
|
$good_type_code = isset($this->post['good_type_code']) && $this->post['good_type_code'] !=="" ? $this->post['good_type_code']:"";
|
|
|
+ if($good_type_code==""){
|
|
|
+ return error_show(1002,"商品属性不能为空");
|
|
|
+ }
|
|
|
$good_name = isset($this->post['good_name']) && $this->post['good_name'] !=="" ? $this->post['good_name'] : "";
|
|
|
+ if($good_name==""){
|
|
|
+ return error_show(1002,"商品名称不能为空");
|
|
|
+ }
|
|
|
$origin_price = isset($this->post['origin_price']) && $this->post['origin_price'] !=="" ? $this->post['origin_price'] :"";
|
|
|
$origin_num = isset($this->post['origin_num']) && $this->post['origin_num'] !=="" ? $this->post['origin_num'] :"";
|
|
|
$check_num = isset($this->post['check_num']) && $this->post['check_num'] !=="" ? $this->post['check_num'] :"";
|
|
@@ -111,10 +120,11 @@ public function create(){
|
|
|
return error_show(1002,"创建失败");
|
|
|
}
|
|
|
}catch (\Exception $e){
|
|
|
- }
|
|
|
Db::rollback();
|
|
|
return error_show(1005,$e->getMessage());
|
|
|
-}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function info(){
|
|
|
$id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
|
if($id==""){
|
|
@@ -127,32 +137,84 @@ public function info(){
|
|
|
return app_show(0,"获取成功",$fo);
|
|
|
}
|
|
|
}
|
|
|
-public function edit(){
|
|
|
- $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
|
- $eid = Db::name('good_check')->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
- if($eid==""){
|
|
|
- return error_show(1002,"未找到盘点编号信息");
|
|
|
+public function edit()
|
|
|
+{
|
|
|
+ $id = isset($this->post['id']) && $this->post['id'] !== "" ? intval($this->post['id']) : "";
|
|
|
+ $eid = Db::name('good_check')->where(['id' => $id, 'is_del' => 0])->find();
|
|
|
+ if ($eid ==="") {
|
|
|
+ return error_show(1002, "未找到盘点编号信息");
|
|
|
}
|
|
|
- $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']) :"";
|
|
|
- if($wsm_code==""){
|
|
|
- return error_show(1002,"盘点仓库不能为空");
|
|
|
+ $wsm_code = isset($this->post['wsm_code']) && $this->post['wsm_code'] !== "" ? trim($this->post['wsm_code']) : "";
|
|
|
+ if ($wsm_code == "") {
|
|
|
+ return error_show(1002, "盘点仓库不能为空");
|
|
|
}
|
|
|
- $type = isset($this->post['type']) && $this->post['type'] !=="" ? trim($this->post['type']) :"";
|
|
|
- if($type==""){
|
|
|
- return error_show(1002,"盘点类型不能为空");
|
|
|
+ $type = isset($this->post['type']) && $this->post['type'] !== "" ? trim($this->post['type']) : "";
|
|
|
+ if ($type == "") {
|
|
|
+ return error_show(1002, "盘点类型不能为空");
|
|
|
}
|
|
|
- $good_type_code = isset($this->post['good_type_code']) && $this->post['good_type_code'] !=="" ? trim($this->post['good_type_code']) :"";
|
|
|
- if($good_type_code==""){
|
|
|
- return error_show(1002,"商品属性不能为空");
|
|
|
+ $good_type_code = isset($this->post['good_type_code']) && $this->post['good_type_code'] !== "" ? trim($this->post['good_type_code']) : "";
|
|
|
+ if ($good_type_code == "") {
|
|
|
+ return error_show(1002, "商品属性不能为空");
|
|
|
}
|
|
|
- $good_name= isset($this->post['good_name']) && $this->post['good_name'] !=="" ? trim($this->post['good_name']):"";
|
|
|
- if($good_name==""){
|
|
|
- return error_show(1002,"商品名称不能为空");
|
|
|
+ $good_name = isset($this->post['good_name']) && $this->post['good_name'] !== "" ? trim($this->post['good_name']) : "";
|
|
|
+ if ($good_name == "") {
|
|
|
+ return error_show(1002, "商品名称不能为空");
|
|
|
+ }
|
|
|
+ $check_code = isset($this->post['check_code']) && $this->post['check_code'] !== "" ? trim($this->post['check_code']) : "";
|
|
|
+ if ($check_code == "") {
|
|
|
+ return error_show(1002, "盘点编号不能为空");
|
|
|
+ }
|
|
|
+ $status = isset($this->post['status']) && $this->post['status'] !== "" ? trim($this->post['status']) : "";
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+ $var = [
|
|
|
+ "id" => $id,
|
|
|
+ "check_code" => $check_code,
|
|
|
+ "wsm_code" => $wsm_code,
|
|
|
+ "type" => $type,
|
|
|
+ "status" => $status,
|
|
|
+ "is_del" => 0,
|
|
|
+ "updatetime" => date("Y-m-d H:i:s")
|
|
|
+ ];
|
|
|
+ $up = Db::name('good_check')->where(['id'=>$id,'is_del' => 0])->save($var);
|
|
|
+ if($up){
|
|
|
+ $varn = [
|
|
|
+ "good_type_code" => $good_type_code,
|
|
|
+ "good_name" => $good_name,
|
|
|
+ "status" => $status,
|
|
|
+ // "check_time" => $check_time,
|
|
|
+ "is_del" => 0,
|
|
|
+ "updatetime" => date("Y-m-d H:i:s")
|
|
|
+ ];
|
|
|
+ $np = Db::name('check_item')->where(["id"=>$eid['id']])->save($varn);
|
|
|
+ //var_dump(Db::name('check_item')->getLastSql());
|
|
|
+ if ($np) {
|
|
|
+ Db::commit();
|
|
|
+ return error_show(0, "盘点更新成功");
|
|
|
+ } else {
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1002, "盘点更新失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ return error_show(1005, $e->getMessage());
|
|
|
+ }
|
|
|
+}
|
|
|
+public function dell(){
|
|
|
+ $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
|
+ if($id===""){
|
|
|
+ return error_show(1004,"参数id不能为空");
|
|
|
+ }
|
|
|
+ $deln= Db::name('good_check')->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
+ if(empty($deln)){
|
|
|
+ return error_show(1002,"未找到数据");
|
|
|
+ }
|
|
|
+ $sv = Db::name('good_check')->update(['id'=>$id,'is_del'=>1,'updatetime'=>date("Y-m-d H:i:s")]);
|
|
|
+ if($sv){
|
|
|
+ return error_show(0,"删除成功");
|
|
|
+ }else{
|
|
|
+ return error_show(1002,"删除失败");
|
|
|
}
|
|
|
- $apply_id = isset($this->post['apply_id']) && $this->post['apply_id'] !=="" ? intval($this->post['apply_id']) :"";
|
|
|
- $apply_name= isset($this->post['apply_name']) && $this->post['apply_name'] !=="" ? trim($this->post['apply_name']) :"";
|
|
|
- $status = isset($this->post['status']) && $this->post['status'] !=="" ? trim($this->post['status']) :"";
|
|
|
- $origin_price = isset($this->post['origin_price']) && $this->post['origin_price'] !=="" ? trim($this->post['origin_price']):"";
|
|
|
-
|
|
|
}
|
|
|
}
|