def createRefundCard(request, aid, mid): applycard = APPLYCARDDICT[aid[0]]["applycardmodel"].objects.get( applycard_code=aid) try: applycarditem = APPLYCARDDICT[ aid[0]]["applycarditemmodel"].objects.get(id=mid) except: applycarditem = None refundCardModel = REFUNDCARDDICT[aid[0].lower()]["refundcardmodel"] refundCard = refundCardModel() refundCard.set_attr(applycard, applycarditem, get_card_code(refundCardModel)) refundCard.save() try: refundCardItemModel = REFUNDCARDDICT[aid[0].lower()][ "refundcarditemmodel%s" % (applycarditem.storelist.steel_type)] except: refundCardItemModel = REFUNDCARDDICT[ aid[0].lower()]["refundcarditemmodel"] try: refundCardItem = refundCardItemModel() refundCardItem.set_attr(refundCard, applycarditem) refundCardItem.save() except: pass return simplejson.dumps({ "status": 1, "message": u"退库单号" + refundCard.refund_code })
def createWeldingMaterialApplyCard(request, materielCopys): applycard_codes = [] for item in materielCopys: applyCard = WeldingMaterialApplyCard(applycard_code=get_card_code(WeldingMaterialApplyCard), work_order = item.sub_workorder, material_code=item.quality_number, material_mark=item.material.name, specification=item.specification, apply_count=item.count,) applyCard.save() applycard_codes.append(applyCard.applycard_code) return applycard_codes
def createSteelMaterialApplyCard(request, materielCopys): steelMaterialApplyCard = SteelMaterialApplyCard(applycard_code=get_card_code(SteelMaterialApplyCard),) steelMaterialApplyCard.save() for item in materielCopys: applyCardItem = SteelMaterialApplyCardItems(apply_card = steelMaterialApplyCard, material_mark=item.material.name, material_code=item.quality_number, count=item.count, work_order = item.sub_workorder, specification = item.specification, ) applyCardItem.save() return [steelMaterialApplyCard.applycard_code]
def createWeldingMaterialApplyCard(request, materielCopys): applycard_codes = [] for item in materielCopys: applyCard = WeldingMaterialApplyCard( applycard_code=get_card_code(WeldingMaterialApplyCard), work_order=item.sub_workorder, material_code=item.quality_number, material_mark=item.material.name, specification=item.specification, apply_count=item.count, ) applyCard.save() applycard_codes.append(applyCard.applycard_code) return applycard_codes
def createSteelMaterialApplyCard(request, materielCopys): steelMaterialApplyCard = SteelMaterialApplyCard( applycard_code=get_card_code(SteelMaterialApplyCard), ) steelMaterialApplyCard.save() for item in materielCopys: applyCardItem = SteelMaterialApplyCardItems( apply_card=steelMaterialApplyCard, material_mark=item.material.name, material_code=item.quality_number, count=item.count, work_order=item.sub_workorder, specification=item.specification, ) applyCardItem.save() return [steelMaterialApplyCard.applycard_code]
def createOutsideApplyCard(request, materielCopys): outsideApplyCard = OutsideApplyCard(applycard_code=get_card_code(OutsideApplyCard), work_order=materielCopys[0].sub_workorder,) outsideApplyCard.save() for item in materielCopys: applyCardItem = OutsideApplyCardItems(apply_card = outsideApplyCard, schematic_index=item.schematic_index, specification=item.name, material_mark=item.material.name, material_code=item.quality_number, unit=item.unit, count=item.count, ) applyCardItem.save() return [outsideApplyCard.applycard_code]
def createOutsideApplyCard(request, materielCopys): outsideApplyCard = OutsideApplyCard( applycard_code=get_card_code(OutsideApplyCard), work_order=materielCopys[0].sub_workorder, ) outsideApplyCard.save() for item in materielCopys: applyCardItem = OutsideApplyCardItems( apply_card=outsideApplyCard, schematic_index=item.schematic_index, specification=item.name, material_mark=item.material.name, material_code=item.quality_number, unit=item.unit, count=item.count, ) applyCardItem.save() return [outsideApplyCard.applycard_code]
def createRefundCard(request, aid, mid): applycard=APPLYCARDDICT[aid[0]]["applycardmodel"].objects.get(applycard_code=aid) try: applycarditem=APPLYCARDDICT[aid[0]]["applycarditemmodel"].objects.get(id=mid) except: applycarditem=None refundCardModel=REFUNDCARDDICT[aid[0].lower()]["refundcardmodel"] refundCard = refundCardModel() refundCard.set_attr(applycard, applycarditem, get_card_code(refundCardModel)) refundCard.save() try: refundCardItemModel=REFUNDCARDDICT[aid[0].lower()]["refundcarditemmodel%s" % (applycarditem.storelist.steel_type)] except: refundCardItemModel=REFUNDCARDDICT[aid[0].lower()]["refundcarditemmodel"] try: refundCardItem = refundCardItemModel() refundCardItem.set_attr(refundCard, applycarditem) refundCardItem.save() except: pass return simplejson.dumps({"status":1, "message":u"退库单号"+refundCard.refund_code})