|
@@ -49,8 +49,8 @@
|
49
|
49
|
<div>
|
50
|
50
|
<el-button size="small" type="primary" @click="updateGoodOrder">保存</el-button>
|
51
|
51
|
<el-button size="small" type="primary" @click="toClick" v-show="showThree">生成采购退货单</el-button>
|
52
|
|
- <el-button size="small" type="primary" v-show="showOne">审核</el-button>
|
53
|
|
- <el-button size="small" type="primary" v-show="showTwo">反审核</el-button>
|
|
52
|
+ <el-button size="small" type="primary" v-show="showOne" @click="checkGoodOrder">审核</el-button>
|
|
53
|
+ <el-button size="small" type="primary" v-show="showTwo" @click="MofyGoodOrder">反审核</el-button>
|
54
|
54
|
|
55
|
55
|
|
56
|
56
|
</div>
|
|
@@ -275,7 +275,7 @@
|
275
|
275
|
<script>
|
276
|
276
|
import BreadCrumb from "@/xt_pages/components/bread-crumb";
|
277
|
277
|
import {uParseTime } from '@/utils/tools'
|
278
|
|
-import {getInitOrder,checkPurchaseOrder,getGoodOrderDetail,updateGoodOrder,getGoodOrderCountList,ModefySupplyWarehousing} from "@/api/supply"
|
|
278
|
+import {getInitOrder,checkPurchaseOrder,getGoodOrderDetail,updateGoodOrder,getGoodOrderCountList,ModefySupplyWarehousing,MofyGoodOrder,UpdateSupplyWahouseingInfo} from "@/api/supply"
|
279
|
279
|
export default {
|
280
|
280
|
name: "addPurchaseOrder",
|
281
|
281
|
components: {
|
|
@@ -818,6 +818,124 @@ getTimes(time) {
|
818
|
818
|
},
|
819
|
819
|
toClick(){
|
820
|
820
|
this.$router.push({path:"/good/return/add?id="+this.id})
|
|
821
|
+ },
|
|
822
|
+ //反审核
|
|
823
|
+ MofyGoodOrder(){
|
|
824
|
+ var id = this.$route.query.id
|
|
825
|
+ var warehousing_id = this.$route.query.warehousing_id
|
|
826
|
+ var params = {
|
|
827
|
+ id:id,
|
|
828
|
+ warehousing_id:warehousing_id,
|
|
829
|
+ }
|
|
830
|
+ MofyGoodOrder(params).then(response=>{
|
|
831
|
+ if(response.data.state == 1){
|
|
832
|
+ var msg = response.data.data.msg
|
|
833
|
+ if(msg == 1){
|
|
834
|
+ this.$message.success("反审核成功!")
|
|
835
|
+ }
|
|
836
|
+ if(msg == 2){
|
|
837
|
+ this.$message.success("该单有自动出库或生成了退货单,反审核失败!")
|
|
838
|
+ }
|
|
839
|
+
|
|
840
|
+ var purcaseOrder = response.data.data.purcaseOrder
|
|
841
|
+ console.log("采购订单",purcaseOrder)
|
|
842
|
+
|
|
843
|
+ var goodOrder = response.data.data.goodOrder
|
|
844
|
+ console.log("采购单",goodOrder)
|
|
845
|
+ var drugList = response.data.data.drugList
|
|
846
|
+ console.log("druglist23323223",drugList)
|
|
847
|
+ var ids =""
|
|
848
|
+ // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
|
|
849
|
+ if(goodOrder.length == 0){
|
|
850
|
+ this.$router.push({path:"/good/order/add?id="+id+"&ids="+ids})
|
|
851
|
+ }
|
|
852
|
+ for(let i=0;i<purcaseOrder.length;i++){
|
|
853
|
+ for(let j=0;j<drugList.length;j++){
|
|
854
|
+ if(purcaseOrder[i].is_source == 1){
|
|
855
|
+ if(purcaseOrder[i].supply_unit == drugList[j].max_unit){
|
|
856
|
+ purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number
|
|
857
|
+ }
|
|
858
|
+ }
|
|
859
|
+ }
|
|
860
|
+ }
|
|
861
|
+
|
|
862
|
+ for(let i=0;i<goodOrder.length;i++){
|
|
863
|
+ for(let j=0;j<drugList.length;j++){
|
|
864
|
+ if(goodOrder[i].is_source == 1){
|
|
865
|
+ if(goodOrder[i].supply_unit == drugList[j].max_unit){
|
|
866
|
+ goodOrder[i].count = goodOrder[i].count * drugList[j].min_number
|
|
867
|
+ }
|
|
868
|
+ }
|
|
869
|
+ }
|
|
870
|
+ }
|
|
871
|
+
|
|
872
|
+ let objInfo = {}
|
|
873
|
+ if (goodOrder.length >0){
|
|
874
|
+ goodOrder.forEach((item,index)=>{
|
|
875
|
+ let { project_id } = item
|
|
876
|
+ if(!objInfo[project_id]){
|
|
877
|
+ objInfo[project_id] = {
|
|
878
|
+ project_id,
|
|
879
|
+ child:[],
|
|
880
|
+ count:0,
|
|
881
|
+ }
|
|
882
|
+ }
|
|
883
|
+ })
|
|
884
|
+ let newArr = Object.values(objInfo);
|
|
885
|
+
|
|
886
|
+ for(let i=0;i<goodOrder.length;i++){
|
|
887
|
+ for(let j=0;j<newArr.length;j++){
|
|
888
|
+ if(goodOrder[i].project_id == newArr[j].project_id){
|
|
889
|
+ newArr[j].child.push(goodOrder[i])
|
|
890
|
+ }
|
|
891
|
+ }
|
|
892
|
+ }
|
|
893
|
+ console.log("newAr2332232323",newArr)
|
|
894
|
+
|
|
895
|
+ for(let i=0;i<newArr.length;i++){
|
|
896
|
+ for(let j=0;j<newArr[i].child.length;j++){
|
|
897
|
+ newArr[i].count += newArr[i].child[j].count
|
|
898
|
+ }
|
|
899
|
+ }
|
|
900
|
+
|
|
901
|
+ var arr = []
|
|
902
|
+ var total = 0
|
|
903
|
+ var str = ""
|
|
904
|
+
|
|
905
|
+ //如果采购单有数据,则需要比较数量
|
|
906
|
+ if(newArr.length > 0){
|
|
907
|
+ for(let i=0;i<purcaseOrder.length;i++){
|
|
908
|
+ for(let j=0;j<newArr.length;j++){
|
|
909
|
+ if(purcaseOrder[i].project_id == newArr[j].project_id){
|
|
910
|
+ //根据商品ID比较数量大小,如果采购单的数量大于采购订单的数据
|
|
911
|
+ if(purcaseOrder[i].count < newArr[j].count){
|
|
912
|
+ arr.push(purcaseOrder[i].project_id)
|
|
913
|
+ }
|
|
914
|
+
|
|
915
|
+ }
|
|
916
|
+ }
|
|
917
|
+ }
|
|
918
|
+ //如果total的长度等于0,怎修改该订单的状态为全部入库
|
|
919
|
+
|
|
920
|
+ if(arr.length > 0){
|
|
921
|
+ //修改采购订单的状态为全部入库
|
|
922
|
+ this.UpdateSupplyWahouseingInfo()
|
|
923
|
+ }
|
|
924
|
+ }
|
|
925
|
+ }
|
|
926
|
+
|
|
927
|
+ }
|
|
928
|
+ })
|
|
929
|
+ },
|
|
930
|
+ UpdateSupplyWahouseingInfo(){
|
|
931
|
+ var params = {
|
|
932
|
+ warehousing_id:this.$route.query.warehousing_id,
|
|
933
|
+ }
|
|
934
|
+ UpdateSupplyWahouseingInfo(params).then(response =>{
|
|
935
|
+ if(response.data.state == 1){
|
|
936
|
+ var msg = response.data.data.msg
|
|
937
|
+ }
|
|
938
|
+ })
|
821
|
939
|
}
|
822
|
940
|
},
|
823
|
941
|
created(){
|